
******************************************************************************************************************************************************************
******************************************************************************************************************************************************************
*************Figures for: "Cadasters and Economic Growth: A Long-Run Cross-Country Panel" D'Arcy, Nistotskaya & Olsson, JPE, R3, November, 2023*******************


**********SECTION 2*****************************************************************


**************************************************
***Figure 2: Evolution of Cadaster over time in United Kingdom and Turkey

use "${datapath}\cadaster_main.dta", clear

line cad year if cname=="United Kingdom"
	graph export "${outpath}\fig2a.png", replace
	
line cad year if cname=="Turkey"
	graph export "${outpath}\fig2b.png", replace

	

************************************************************************************
***Figure 3: Evolution of Cadaster over time across world regions

use "${datapath}\cadaster_main.dta", clear

*Africa*
preserve
collapse (mean) cad, by(year region2)
twoway (line cad year if region2==1, yti(Mean Cadaster score, size(medium)) xti(Year, size(medium))) 
	graph export "${outpath}\fig3a.png", replace 
restore

*LA & Caribbean*
preserve
collapse (mean) cad, by(year region2)
twoway (line cad year if region2==2, yti(Mean Cadaster score, size(medium)) xti(Year, size(medium))) 
	graph export "${outpath}\fig3b.png", replace 
restore

*Asia*
preserve
collapse (mean) cad, by(year region2)
twoway (line cad year if region2==3, yti(Mean Cadaster score, size(medium)) xti(Year, size(medium))) 
	graph export "${outpath}\fig3c.png", replace 
restore

*Europe*
preserve
collapse (mean) cad, by(year region2)
twoway (line cad year if region2==4, yti(Mean Cadaster score, size(medium)) xti(Year, size(medium))) 
	graph export "${outpath}\fig3d.png", replace 
restore

*Middle East*
preserve
collapse (mean) cad, by(year region2)
twoway (line cad year if region2==5, yti(Mean Cadaster score, size(medium)) xti(Year, size(medium))) 
	graph export "${outpath}\fig3e.png", replace 
restore

*Western*
preserve
collapse (mean) cad, by(year region2)
twoway (line cad year if region2==6, yti(Mean Cadaster score, size(medium)) xti(Year, size(medium))) 
	graph export "${outpath}\fig3f.png", replace 
restore

*World*
preserve
collapse (mean) cad, by(year)
twoway (line cad year, yti(Mean Cadaster score, size(medium)) xti(Year, size(medium))) 
	graph export "${outpath}\fig3g.png", replace 
restore



*************SECTION 3*************************************************************

*****************************************************************
***Figure 4***

use "${datapath}\cadaster_main.dta", clear

binscatter g2 cad, controls(lag1y2) yti(Growth rate of real GDP per capita (%), size(medium)) xti(Cadaster index, size(medium))
	graph export "${outpath}\fig4.png", replace

*Include regression coefficients in figure
reg g2 cad lag1y2, r



************************************************************************************
***Figure 5: Semi-parametric analysis of ATET, 1900-2015***
*Note: Semiparametric analysis of treatment effect of full cadastral reform (cadaster=1 vs cadaster<1) with (probit) inverse propensity score reweighting, broadly following ANRR (2019, section 4). The graph excludes extreme outliers Kuwait and Qatar*


use "${datapath}\cadaster_main.dta", clear

*Comparing means GDP growth conditional on c=1 and c=0 in the full sample and since 1900 for discussion in text
mean g2 if cad_full==1&cname!="Kuwait"&cname!="Qatar"
mean g2 if cad_full==0&cname!="Kuwait"&cname!="Qatar"
pwmean g2 if cname!="Kuwait"&cname!="Qatar", over(cad_full)

mean g2 if cad_full==1 &year>=1900&name!="Kuwait"&cname!="Qatar"
mean g2 if cad_full==0 &year>=1900&name!="Kuwait"&cname!="Qatar"
pwmean g2 if year>=1900, over(cad_full)

*For interpretation: An analysis of 51 transitions to full cadaster 1900-2015, evenly spread out over the whole period. Some countries in former USSR made a transition twice. Only 19 included in the estimations due to missing y data."

total tcad if year>=1900
list cname year g2 if tcad==1&year>=1900
*This shows that Kuwait and Qatar after Gulf War in 1992 are outliers with g2=72% and 19.17% respectively 
hist year if tcad==1&year>=1900


*Semiparametric (teffects) analysis geneerating Figure 5 (excluding outliers Kuwait and Qatar)

foreach n of numlist 0/15 {
	qui teffects ipw (y2dep`n') (tcad lag1y2 lag2y2 lag3y2 lag4y2 i.year, noconstant probit) if year>=1900&cname!="Kuwait"&cname!="Qatar", atet iterate(7) 
	estimates store t`n'
}
coefplot (t0 \t1 \t2 \t3 \t4 \t5 \t6 \t7 \t8 \t9 \t10 \t11 \t12 \t13 \t14 \t15), aseq swapnames vertical ciopts(recast(rcap)) mlabel(@b) format(%12.2f) yti(Change in GDP pc (log points), size(medium)) xti(Time, size(medium))



****************************************************************************************
***Figure 6: Spatial parameter heterogeneity: Effect of Cadaster on GDP per capita across world regions, 1900-2015
*Note: The graph presents the within coefficients of the effect of Cadaster on (log) GDP per capita for the world as a whole as well as for five macro regions.

use "${datapath}\cadaster_main.dta", clear

*M1: All*
qui xtreg y2 cad L(1/4).y2  i.year if year>=1900, fe cluster(ccode)	
		estimates store all

*M2: Europe*
qui xtreg y2 cad L(1/4).y2  i.year if region2==4&year>=1900, fe cluster(ccode)	
		estimates store europe
		
*M3: Africa*
qui xtreg y2 cad L(1/4).y2  i.year if region2==1&year>=1900, fe cluster(ccode)	
		estimates store africa
		
*M4: Middle East*
qui xtreg y2 cad L(1/4).y2  i.year if region2==5&year>=1900, fe cluster(ccode)	
		estimates store meast	
		
*M5: Asia*
qui xtreg y2 cad L(1/4).y2  i.year if region2==3&year>=1900, fe cluster(ccode)	
		estimates store asia

*M6: Latin America and the Caribbean*
qui xtreg y2 cad L(1/4).y2  i.year if region2==2&year>=1900, fe cluster(ccode)	
		estimates store lacarib
	
*Coefficient boxplot based on estimated parameters above*/
coefplot all europe africa meast asia lacarib, aseq vertical keep(cad) swapnames ciopts(recast(rcap)) mlabel(@b) format(%12.2f) yti(Beta-coefficient for Cadaster(*100), size(medium)) xti(Continent, size(medium))
	graph export "${outpath}\fig6.png", replace



*****************************************************************************************************
***Figure 7: Event study of full cadastral reform on average GDP growth rate per capita during a 100-year window in Sweden, France, Netherlands, and Italy

use "${datapath}\cadaster_main.dta", clear

*Sweden 1578-1678
twoway (fpfitci g2_ma5 year if cname=="Sweden"&year>=1578&year<1628)(fpfitci g2_ma5 year if cname=="Sweden"&year>=1628&year<1678)(scatter g2_ma5 year if cname=="Sweden"&year>=1578&year<1678)
	graph export "${outpath}\fig7a.png", replace

*France 1757-1857
twoway (fpfitci g2_ma5 year if cname=="France"&year>=1757&year<1807)(fpfitci g2_ma5 year if cname=="France"&year>=1807&year<1857)(scatter g2_ma5 year if cname=="France"&year>=1757&year<1857)
	graph export "${outpath}\fig7b.png", replace

*Netherlands 1763-1863
twoway (fpfitci g2_ma5 year if cname=="Netherlands"&year>=1763&year<1813)(fpfitci g2_ma5 year if cname=="Netherlands"&year>=1813&year<1863)(scatter g2_ma5 year if cname=="Netherlands"&year>=1763&year<1863)
	graph export "${outpath}\fig7c.png", replace
	
*Italy 1847-1947
twoway (fpfitci g2_ma5 year if cname=="Italy"&year>=1847&year<1897)(fpfitci g2_ma5 year if cname=="Italy"&year>=1897&year<1947)(scatter g2_ma5 year if cname=="Italy"&year>=1847&year<1947)
	graph export "${outpath}\fig7d.png", replace

	
	

